package cn.yangyanzhao.gupaoedu.rmi;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class ClientDemo {

	public static void main(String[] args) {
		try {
			IHelloService service = (IHelloService)Naming.lookup("rmi://127.0.0.1:8081/Hello");
			
			String result = service.sayHello("Toms");
			System.out.println(result);
			
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
	}

}
